package ah.szxy.task;

import ah.szxy.sink.Sink;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class Input5MessagePollTask {

    @Autowired
    private Sink sink ;

    @Scheduled(initialDelay = 5000L,fixedRate = 5000L)
    public void poll(){
        sink.input5().poll(new MessageHandler() {
            @Override
            public void handleMessage(Message<?> message) throws MessagingException {
                System.out.println(message.getPayload());
            }
        });
    }
}
